#include <stdio.h>
#include <windows.h>
#include <setupapi.h>
//#include <devguid.h>
#include <iostream>
#include <cfgmgr32.h>
#include <tchar.h>
#include <qt/qvariant.h>
#include <qt/qlist.h>
#include "DeviceInformation.h"
#include <devguid.h>

#include <fstream>
#include <iostream>
#include <sstream>
#include <map>

using namespace std;

#pragma comment(lib, "setupapi.lib")

#ifndef GUID_DEVINTERFACE_USB_HUB
// http://msdn.microsoft.com/en-us/library/bb663109.aspx
const GUID GUID_DEVINTERFACE_USB_HUB = {0xf18a0e88, 0xc30c, 0x11d0, {0x88, 0x15, 0x00,	0xa0, 0xc9, 0x06, 0xbe, 0xd8}};  
#endif
#ifndef GUID_DEVINTERFACE_USB_DEVICE
// http://msdn.microsoft.com/en-us/library/bb663093.aspx
const GUID GUID_DEVINTERFACE_USB_DEVICE = {  0xa5dcbf10, 0x6530, 0x11d2, {0x90, 0x1f, 0x00, 0xc0, 0x4f, 0xb9, 0x51, 0xed} };
#endif

#ifndef GUID_DEVINTERFACE_USB_HOST_CONTROLLER
// http://msdn.microsoft.com/en-us/library/bb663109.aspx
const GUID GUID_DEVINTERFACE_USB_HOST_CONTROLLER = {  0x3ABF6F2D, 0x71C4, 0x462A, {0x8A, 0x92, 0x1E, 0x68, 0x61, 0xE6, 0xAF, 0x27} };
#endif

class UsbEnumerator
{
private:
	
	QList<DeviceInformation*> deviceList;
	void MapFile(const WCHAR *filename);
public:
	map<wstring, wstring> VID_MAP;
	map<wstring, wstring> PID_MAP;
	UsbEnumerator(const WCHAR* infFile);
	bool isHub(WCHAR*);
	void ToEnumerate();

};